import axios from 'axios'
import server from './server'

const baseUrl = server.baseUrl;
const startUrl = '/public/user'

/**用户_查看个人信息*/
export const userGet = (token) => {
    return axios.get(`${baseUrl}${startUrl}/userGet`, {
        headers: {
            'Content-Type': 'application/json',
            'Authorization': token
        }
    })    
}

/**用户_修改个人信息*/
export const userSet = (token, data) => {
    return axios.post(`${baseUrl}${startUrl}/userSet`, data, {
        headers: {
            'Content-Type': 'application/json',
            'Authorization': token
        }
    })    
}

/**用户_发布文章*/
export const userCreateArt = (token, data) => {
    return axios.post(`${baseUrl}${startUrl}/article/create`, data, {
        headers: {
            'Content-Type': 'application/json',
            'Authorization': token
        }
    })    
}

/**用户_编辑文章*/
export const userUpdateArt = (token, data) => {
    return axios.post(`${baseUrl}${startUrl}/userUpdateArt`, data, {
        headers: {
            'Content-Type': 'application/json',
            'Authorization': token
        }
    })    
}

/**用户_查看个人文章*/
export const getUserArtPage = (token, data) => {
    return axios.post(`${baseUrl}${startUrl}/getUserArtPage`, data, {
        headers: {
            'Content-Type': 'application/json',
            'Authorization': token
        }
    })    
}

/**用户_删除个人文章*/
export const delUserArtPage = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/delUserArtPage`, {
        params: params,
        headers: {
            // 'Content-Type': 'application/json',
            'Authorization': token
        }
    })    
}

/**用户_查看个人收藏文档*/
export const getUserCollectArt = (token, data) => {
    return axios.post(`${baseUrl}${startUrl}/getUserCollectArt`, data, {
        headers: {
            'Content-Type': 'application/json',
            'Authorization': token
        }
    })    
}

/**用户_取消收藏文档*/
export const unCollectArt = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/unCollectArt`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_收藏文档*/
export const collectArt = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/collectArt`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_点赞文档*/
export const likeArt = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/likeArt`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_设置文章分类*/
export const setArticleType = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/setArticleType`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_设置文章标签*/
export const setArticleTag  = (token, params) => {
    return axios.post(`${baseUrl}${startUrl}/setArticleTag`, params, {
        headers: {
            'Authorization': token,
            'Content-Type': 'application/x-www-form-urlencoded',
        }
    })    
}

/**用户_根据用户查找关注*/
export const getUserFocusById = (token) => {
    return axios.get(`${baseUrl}${startUrl}/getUserFocusById`, {
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_关注用户*/
export const focusUserById = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/focusUserById`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_取消关注用户*/
export const unFocusUserById = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/unFocusUserById`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_评论文章*/
export const commentArt = (token, data) => {
    return axios.post(`${baseUrl}${startUrl}/commentArt`, data, {
        headers: {
            'Authorization': token,
            'Content-Type': 'application/json'
        }
    })
}

/**用户_回复评论*/
export const replyComment = (token, data) => {
    return axios.post(`${baseUrl}${startUrl}/replyComment`, data, {
        headers: {
            'Authorization': token,
            'Content-Type': 'application/json'
        }
    })
}












/**用户_添加好友*/
export const addFriend = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/addFriend`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_查找用户好友*/
export const getFriendByUser = (token) => {
    return axios.get(`${baseUrl}${startUrl}/getFriendByUser`, {
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_查找好友请求*/
export const getFriendReq = (token) => {
    return axios.get(`${baseUrl}${startUrl}/getFriendReq`, {
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_删除好友请求*/
export const delFriend = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/delFriend`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_同意好友请求*/
export const agreeFriendRea = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/agreeFriendRea`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_拒绝好友请求*/
export const rejuctFriendRea = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/rejuctFriendRea`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_获取文章浏览历史记录*/
export const browseHistory = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/browseHistory`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_进入对话状态*/
export const userDialogue = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/userDialogue`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_获取聊天列表*/
export const getUserDialogue = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/getUserDialogue`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_获取聊天列表*/
export const getDialogues = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/getDialogues`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}

/**用户_获取聊天列表*/
export const sendMessage = (token, params) => {
    return axios.get(`${baseUrl}${startUrl}/sendMessage`, {
        params: params,
        headers: {
            'Authorization': token
        }
    })    
}












